package n08.second;

import java.util.function.Function;

public class N02 {

	public static void main(String[] args) {
		Function<String, Integer> f=new Function<String, Integer>(){
			@Override
			public Integer apply(String t) {
				return t.length();
			}
		};
		int len = f.apply("Hello world");
		System.out.println(len);
		//(2)用lamda表达式替代匿名内部类对象
		Function<String, Integer> f2 = t->t.length();
		System.out.println(f2.apply("Hello"));
		
	}

}
